﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using XingLucifer.Devices.Devices.ElectronicScales;
using XingLucifer.Devices.Protocols;
using XingLucifer.IBase;
using XingLucifer.IBase.Enums;

namespace XingLucifer.Devices
{
    public class EquipmentFactory
    {
        public static IBase.IDevices NewSocketDevice(byte suffixIP, string ip, int port, DeviceTypes deviceTypes, int index, TaskTypes taskType, string serviceName, CancellationTokenSource token, ICommunication com)
        {

            switch (deviceTypes)
            {
                case DeviceTypes.NX_FINS_PLC:
                    return new UDP_Fins(suffixIP, ip, port, token);
                case DeviceTypes.NJ_FINS_PLC:
                    return new TCP_FinsFins(suffixIP, com);
                case DeviceTypes.S715_PLC:
                    break;
                case DeviceTypes.S712_PLC:
                    break;
                case DeviceTypes.Modbus_TCP_ABCD:
                case DeviceTypes.Modbus_TCP_CDAB:
                case DeviceTypes.Modbus_TCP_BADC:
                case DeviceTypes.Modbus_TCP_DCBA:
                    return new TCP_Modbus(1, com);
                case DeviceTypes.TC06_Scale:
                    return new Devices.ElectronicScales.TC06(com, token);
                case DeviceTypes.AND4531B_Scale:
                    return new Devices.ElectronicScales.AND4531B(com, token);
                case DeviceTypes.ST5520_ShortCircuit:
                    return new Devices.Testers.ST5520(com, token);
                case DeviceTypes.RJ6902R_ShortCircuit:
                case DeviceTypes.RJ6902CAGX_ShortCircuit:
                    return new Devices.Testers.RJ6902R(com, token);
                case DeviceTypes.SR1000:
                case DeviceTypes.SR700:
                    return new Devices.ScanCode.Keenes_SR(com, token);
                case DeviceTypes.JS_03B_Scale:
                    return new Devices.ElectronicScales.JS_03B(com, token);
                case DeviceTypes.CIP_Omron:
                    return new OmronCIP(com, token);
                     case DeviceTypes.TSC_L:
                    return new TSC_L(com, token);

            }
            return null;
        }
    }
}
